package com.shoeHouse.departmentInfo.service;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.shoeHouse.departmentInfo.dao.DepartmentInfoMapper;
import com.shoeHouse.departmentInfo.model.DepartmentInfo;
import com.shoeHouse.departmentInfo.model.DepartmentInfoExample;
import com.shoeHouse.departmentInfo.model.DepartmentInfoExample.Criteria;
import com.shoeHouse.departmentInfo.model.DepartmentInfoExample.Criterion;
import com.shoeHouse.util.PageHelper;

@Service
public class DepartmentInfoServiceImpl implements DepartmentInfoService{
	
	@Autowired
     private DepartmentInfoMapper departmentInfoMapper;

	@Override
	public void save(DepartmentInfo o) {
		// TODO Auto-generated method stub
		departmentInfoMapper.insert(o);
	}

	@Override
	public void deleteAll(String ids) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void removeAll(String ids) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void update(DepartmentInfo o) {
		// TODO Auto-generated method stub
		DepartmentInfoExample example=new DepartmentInfoExample();
		Criteria criteria=example.createCriteria();
		criteria.andIdEqualTo(o.getId());
		departmentInfoMapper.updateByExampleSelective(o, example);
	}

	@Override
	public int count() {
		// TODO Auto-generated method stub
		DepartmentInfoExample example=new DepartmentInfoExample();
		Criteria criteria=example.createCriteria();
		criteria.andStatusEqualTo(Byte.valueOf("0"));
		int count=departmentInfoMapper.countByExample(example);
		return count;
	}

	@Override
	public List<DepartmentInfo> getAll(HttpServletRequest request,DepartmentInfo departmentInfo, PageHelper pageHelper) {
		// TODO Auto-generated method stub
		DepartmentInfoExample example=new DepartmentInfoExample();
		Criteria criteria=example.createCriteria();
		criteria.andStatusEqualTo(Byte.valueOf("0"));
		
		List<DepartmentInfo> list=departmentInfoMapper.selectByExample(example);
		return list;
	}

	@Override
	public DepartmentInfo getSingle(DepartmentInfo departmentInfo) {
		// TODO Auto-generated method stub
		DepartmentInfoExample example=new DepartmentInfoExample();
		Criteria criteria=example.createCriteria();
		criteria.andStatusEqualTo(Byte.valueOf("0"));
		DepartmentInfo info=departmentInfoMapper.selectByPrimaryKey(departmentInfo.getId());
		return info;
	}
}
